<?php
/**
 * Модель mail_to_user
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель mail_to_user
 *
 */
class ModelMail_to_user extends Model {
	
	const TABLE				= 'mail_to_user';
	const F_MAIL_ID  	= 'mail_id';
	const F_USER_ID  	= 'user_id';
	const F_MODE  	= 'mode';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='mail_to_user';
		$this->id_field=array(self::F_MAIL_ID,self::F_USER_ID);
		$this->fields=array(
		self::TABLE.DOT.self::F_MAIL_ID=> new Field($this,self::F_MAIL_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>11,
				'join_table'=>'mail')),
		self::TABLE.DOT.self::F_USER_ID=> new Field($this,self::F_USER_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>11,
				'join_table'=>'user')),
		self::TABLE.DOT.self::F_MODE=> new Field($this,self::F_MODE,self::TABLE,array(
				'lenght'=>1,
				'validate_type'=>Validator::VALIDATE_BOOL))		);
	}
}
